<?php

namespace App\Common\RedisCache;

abstract class AbstractBitMap extends AbstractCache
{
    /**
     * @param string $key
     * @param int $offest
     * @param int $val
     * @return bool
     * @throws \RedisException
     */
    public function set($value):bool
    {
        return self::$client->setBit($this->key,$value,1);
    }

    /**
     * @param string $key
     * @param int $offest
     * @return int
     * @throws \RedisException
     */
    public function get($key = '', int $offest = 0):int
    {
        if ($key === '') {
            $key = $this->key;
        }
        return self::$client->getBit($key,$offest);
    }

    /**
     * @param string $key
     * @param int $offest
     * @param int $end
     * @return int|\Redis
     * @throws \RedisException
     */
    public function bitCount(string $key = '', int $offest = 0, int $end = -1)
    {
        if ($key === '') {
            $key = $this->key;
        }
        return self::$client->bitCount($key, $offest, $end);
    }

    public function len($key = ''):int
    {
    }
}